Respiratory apparatus with improved flow-flattening detection

ABSTRACT

In a respiratory apparatus for treatment of sleep apnea and other disorders associated with an obstruction of a patient&#39;s airway and which uses an airflow signal, an obstruction index is generated which detects the flattening of the inspiratory portion of the airflow. The obstruction index is used to differentiate normal and obstructed breathing. The obstruction index is based upon different weighting factors applied to sections of the airflow signal thereby improving sensitivity to various types of respiration obstructions.

This application claims the priority filing date of U.S. Provisional Application Ser. No. 60/228,630 filed on Aug. 29, 2000.

FIELD OF THE INVENTION

This invention relates to a method and apparatus for detecting obstruction of the airway of a patient. More specifically, the invention involves an improved method and apparatus for detecting obstruction, either partial or complete, based upon a flattened measure of an inspiratory portion of respiratory airflow. The method is useful in patient ventilators such as those used in the diagnosis and treatment of respiratory conditions including sleep apnea or hypopnea.

BACKGROUND OF THE INVENTION

The dangers of obstructed breathing during sleep are well known in relation to the Obstructive Sleep Apnea (OSA) syndrome. Apnea, hypopnea and heavy snoring are recognized as causes of sleep disruption and risk factors in certain types of heart disease.

The monitoring of upper airway pressure-flow relationships in obstructive sleep apnea has been described in Smith et al., 1988, J. Appl Physiol. 64: 789-795. FIG. 1 of that article shows polygraphic sleep recordings at varying levels of increasing nasal pressure. It was noted that inspiratory volumetric flow plateaued in certain breaths suggesting the presence of airflow limitation. Pressure-flow curves were constructed by plotting midinspiratory airflow against either mask pressure or endoesophageal pressure. The pressure-flow plots of nasal pressure against mean midinspiratory flow were then fit by least-squares linear regression to calculate resistance upstream to the collapsible site.

The effect of positive nasal pressure on upper airway pressure-flow relationships has been described in Schwartz et al., 1989, J. Appl Physiol. 66: 1626-1634. FIG. 4 of the article shows that pressure-flow tracings plateau at a low pressure level. It was further shown when the pressure was increased, flow did not plateau.

The common method of treatment of these syndromes is to administer Continuous Positive Airway Pressure (CPAP). The procedure for administering CPAP treatment has been documented in both the technical and patent literature. Briefly stated, CPAP treatment acts as a pneumatic splint of the airway by the provision of a positive pressure, usually in the range 4-20 cm H₂O. The air is supplied by a motor driven blower whose output passes via an air delivery device to sealingly engage a patient's airway. A mask, tracheotomy tube, endotracheal tube, nasal pillows or other appropriate device may be used. An exhaust port is provided in a delivery tube proximate to the air delivery device. Other forms of CPAP, such as bi-level CPAP, and self-titrating CPAP, are described in U.S. Pat. Nos. 5,148,802 and 5,245,995 respectively.

With regard to the control of CPAP treatment, various techniques are known for sensing and detecting abnormal breathing patterns indicative of obstruction. For example, U.S. Pat. No. 5,245,995 describes how snoring and abnormal breathing patterns can be detected by inspiration and expiration pressure measurements while sleeping, thereby leading to early indication of preobstructive episodes or other forms of breathing disorder. Particularly, patterns of respiratory parameters are monitored, and CPAP pressure is raised on the detection of pre-defined patterns to provide increased airway pressure to ideally prevent the occurrence of the obstructive episodes and the other forms of breathing disorder.

Similarly, U.S. Pat. No. 5,335,654 (Rapoport) lists several indices said to be indications of flow limitation and/or partial obstruction patterns including: (1) The derivative of the flow signal equals zero; (2) The second derivative between peaks of the flow signal is zero for a prolonged interval; (3) The ratio of early inspirational flow to midinspirational flow is less than or equal to 1. The patent further lists events said to be indications of obstructions: (1) Reduced slope of the line connecting the peak inspiratory flow to the peak expiratory flow; (2) Steep upward or downward stroke (dV/dt) of the flow signal; and (3) Ratio of inspiratory flow to expiratory flow over 0.5.

U.S. Pat. No. 5,645,053 (Remmers) describes calculating a flatness index, wherein flatness is defined to be the relative deviation of the observed airflow from the mean airflow. In Remmers, individual values of airflow are obtained between 40% and 80% of the inspiratory period. The mean value is calculated and subtracted from individual values of inspiratory flow. The individual differences are squared and divided by the total number of observations minus one. The square root of this result is used to determine a relative variation. The relative variation is divided by the mean inspiratory airflow to give a relative deviation or a coefficient of variation for that breath.

In commonly owned U.S. Pat. No. 5,704,345, Berthon-Jones also discloses a method for detecting partial obstruction of a patient's airway. Generally, the method involves a determination of two alternative obstruction index values based upon the patient's monitored respiratory airflow. Either obstruction index may then be compared to a threshold value. Essentially, the index values may be characterized as shape factors that detect a flattening of an inspiratory portion of a patient's respiratory airflow. The first shape factor involves a ratio of the mean of a midportion of the inspiratory airflow of the breathing cycle and the mean of the inspiratory airflow. The formula for shape factor 1 is as follows: ${{shapefactor\_}1} = \frac{\frac{1}{33}{\sum\limits_{t = 16}^{48}\quad {f_{s}(t)}}}{M}$

where f_(s)(t) is a sample of the patient's inspiratory airflow and M is the mean of inspiratory airflow given by the following: $M = {\frac{1}{65}{\sum\limits_{t = 1}^{65}\quad {f_{s}(t)}}}$

A second shape factor involves a ratio of the Root Mean Square deviation of a midportion of inspiratory airflow and the mean inspiratory airflow according to the formula: ${{shapefactor\_}2} = \frac{\sqrt{\frac{1}{33}{\sum\limits_{t = 16}^{48}\quad \left( {{f_{s}(t)} - M} \right)^{2}}}}{M}$

Berthon-Jones further discloses a scaling procedure applied to the inspiratory airflow samples such that the mean M of the samples f_(s)(t) is unity (M=1). This scaling procedure simplifies both shape factor formulas. Additional adjustments to f_(s)(t) including averaging and the elimination of samples from erratic breaths such as coughs, sighs, hiccups, etc., are also taught by Berthon-Jones. The foregoing U.S. Patent is hereby incorporated by reference.

The present invention involves an improved method and apparatus for detecting some forms of obstruction based upon the flattening of the inspiratory airflow.

BRIEF DESCRIPTION OF THE INVENTION

An objective of the present invention is to provide an apparatus in which obstruction, either partial or complete, of the patient's airway is detected by analyzing respiratory airflow.

A further objective is to provide an apparatus in which a novel algorithm for detecting airway obstruction is implemented without using additional components or making substantial changes to the structure of existing respiratory apparatus.

Accordingly, a respiratory apparatus is provided in which the respiratory airflow of a patient is continuously monitored. The part of respiratory airflow associated with inspiration is identified and sampled. From these inspiration samples, several samples representing a midportion of inspiration are identified. One or more weighting parameters or weighting factors are associated with each midportion sample. These weights and midportion samples are then used to calculate an obstruction index. Finally, this obstruction index is compared to a threshold value which comparison is used to adjust or control ventilatory assistance.

In one embodiment, weighting factors are applied based on whether the inspiratory airflow samples are less than or greater than a threshold level, such as the mean airflow.

In another embodiment, different weighting factors are applied to samples based on their time positions in a breath. Samples taken prior to a certain event during inspiration, for example, samples preceding the half way point of inspiration, are assigned lower weighting factors than samples succeeding the event. An obstruction index is then calculated using these samples with their corresponding weighting factors.

In one aspect, the subject invention pertains to a respiratory apparatus which includes a gas source adapted to selectively provide pressurized breathable gas to a patient, a flow sensor to sense the respiratory airflow from the patient and to generate an airflow signal indicative of airflow, an obstruction detector coupled to said flow sensor which includes a weight assigning member arranged to assign several weight factors to portions of the flow signal and to generate an obstruction signal using the weighted portions, and a controller coupled to the flow sensor and arranged to control the operation of the gas source, receive the obstruction signal and alter the operation of the gas source in response to the obstruction signal.

Another aspect of the invention concerns an apparatus for monitoring and/or treating a patient having a sleep disorder, the apparatus including a flow sensor that senses patient respiration and generates a corresponding flow signal; and an obstruction detector coupled to the flow sensor and adapted to determine a weighted average signal, the weighted average signal being dependent on a weighted average of the flow signal in accordance with one of an amplitude and a time position of portions of the flow signal, the obstruction detector including a signal generator that generates a signal indicative of an airway obstruction based on the weighted average signal.

A further aspect of the invention concerns an apparatus for treating a patient having a sleep disorder, the apparatus comprising a mask, a gas source selectively supplying pressurized breathable air to the patient through the mask, a flow sensor that senses airflow and generates a flow signal indicative of respiration, an obstruction detector coupled to the flow sensor and adapted to determine a weighted average signal, the weighted average signal being dependent on a weighted average of the flow signal in accordance with one of an amplitude and a time position of portions of the flow signal, and a controller receiving the obstruction signal and generating in response a command for activating the gas source.

Another aspect of the invention concerns a method for detecting obstruction in the airways of a patient, including measuring an air flow of the patient, detecting a predetermined section of said air flow, assigning weights to portions of said predetermined section and determining an index value for said predetermined section based on said weights as a measure of the obstruction.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows a block diagram of a respiratory apparatus constructed in accordance with this invention;

FIG. 2 shows a flow chart illustrating the operation of the apparatus of FIG. 1;

FIG. 3 shows the inspiration phases of typical respiration signals for a healthy person and a person with a partial airway obstruction;

FIG. 4 shows a portion of a normal respiration signal from a patient;

FIGS. 5 and 6 show portions of two different respiration signals characteristic from patients with sleep apnea;

FIG. 7 shows a flow chart for determining the flattening indices for the respiration signals of FIGS. 4-6;

FIG. 8 shows a normal breathing pattern for a person without respiratory obstructions to illustrate the determination of two improved obstruction indices;

FIGS. 9, 10, and 11 show various breathing patterns with obstructions identifiable using the improved indices:

FIG. 12 shows an example of how a flow curve can be checked to insure that it is a valid respiration curve; and

FIG. 13 shows an example of how a typical respiration flow curve can be trimmed.

DETAILED DESCRIPTION OF THE INVENTION

Apparatus and Methodology

FIG. 1 shows an example respiratory apparatus 10 constructed in accordance with the invention. The respiratory apparatus 10 includes a mask 12 connected to a blower 14 by a flexible tube 16. The mask 12 is fitted to the patient and may be either a nose mask or a face mask. The blower 14 with an air outlet 22 is driven by a motor 18 in accordance with control signals from a servocontroller 20. This arrangement allows the respiratory apparatus 10 to deliver pressurized air (or air enriched with oxygen from a source, not shown). The pressurized air is delivered by tube 16 to the mask 12. The tube 16 is provided with a narrow exhaust port 26 through which air exhaled by the patient is expelled.

A control circuit 24 is used to control the operation of servocontroller 20 and motor 18 using certain predetermined criteria, thereby defining modes of operation for the apparatus 10. Preferably, in accordance with this invention, the control circuit 24 is adapted to operate the apparatus 10 to provide CPAP to the patient.

Control circuit 24 includes a flow restrictive element 28. Tubes 30 and 31 lead from restrictive element 28 to a differential pressure transducer 34. Tube 30 is also connected through another tube 33 to a mask pressure transducer 32.

The mask pressure transducer 32 generates a first electrical signal which is amplified by an amplifier 36 to generate an output P(t) proportional to the air pressure within the mask 12. This output is fed directly to the servocontroller 20.

The differential pressure transducer 34 senses the differential pressure across the flow restrictive element 28, which differential pressure is related to the air flow rate through the flow restrictive element 28 and tube 16. Differential pressure transducer 34 generates a second electrical signal that is amplified by an amplifier 38. This amplified signal F(t) is termed an air flow signal since it represents the air flow through the tube 16.

The air flow signal F(t) is fed to a filter 40 which filters the signal within a preset range. The outputs of the filter 40 and amplifier 36 are fed to an ADC (analog-to-digital) converter 42, which generates corresponding signals fi to a microprocessor 44. The microprocessor 44 generates analog control signals that are converted into corresponding digital control signals by DAC 46 and used as a reference signal Pset (t) for the servo 20.

One method for the operation of a respiratory apparatus 10 is shown in the flow chart of FIG. 2. Individuals skilled in the art will recognize other methodologies for utilizing the improved flow flattening index that is disclosed herein. The embodiment of the methodology of FIG. 2 is also detailed in U.S. Pat. No. 5,704,345 (the '345 patent). The first step 100 is the measurement of respiratory flow (rate) over time. This information is processed in step 102 to generate Index values to be used as qualitative measures for subsequent processing. Thus, Step 102 includes the generation of obstruction index values based upon the weighting method as disclosed herein. Step 104 detects whether an apnea is occurring by comparison of the breathing Index with a threshold value.

If the answer in step 104 is “Yes”, an apnea is in progress and there then follows a determination of patency in step 110. If there is patency of the airway, a central apnea with an open airway is occurring, and, if desired, the event is logged in step 112. If the result of step 110 is that the airway is not patent, then a total obstructive apnea or a central apnea with closed airway is occurring, which results in the commencement or increase in CPAP treatment pressure in step 108. If desired, step 108 may include the optional logging of the detected abnormality.

If the answer in step 104 is “No”, one or more obstruction indices, such as the improved flow flattening indices, are compared with threshold values in step 106, by which the determination of obstruction of the airway is obtained. If the answer is “Yes” in step 106, then there is a partial obstruction, and if “No”, there is no obstruction (normalcy).

Step 108 applies in the case of a complete or partial obstruction of the airway a consequential increase in CPAP treatment pressure. In the instance of normal breathing with no obstruction, the CPAP treatment pressure is reduced, in accordance with usual methodologies that seek to set the minimal pressure required to obviate, or at least reduce, the occurrence of apneas. The amount of reduction in step 107 may, if desired, be zero. Similarly, in the event of a central apnea with patent airway (step 110,112) treatment pressure is not increased. Such increases in pressure reflexively inhibit breathing, further aggravating the breathing disorder.

Improved Flow Flattening Indices

FIG. 3 depicts an airflow signal with respect to the inspiratory portion of a typical breathing cycle. During the inspiratory portion of the breathing cycle of a healthy person, the airflow rises smoothly with inspiration, reaches a peak and falls smoothly to zero. However, a patient with a partially obstructed airway exhibits a breathing pattern characterized by a significant flat zone during inspiration. Theoretically, for an obstructed flow, as the degree of partial obstruction increases, the airflow signal for inspiration would tend to a square wave.

As previously discussed, the '345 patent describes two shape factors useful in testing for a flattening of the inspiratory portion of a patient's breathing cycle. In the preferred embodiment of the invention, the resulting obstruction index or flow flattening index (FFI) for each shape factor may be compared to unique threshold values. While the approach works well in many instances, it may not detect certain obstruction patterns.

This can be illustrated by an examination of FIGS. 4-6. FIGS. 4-6 depict portions of respiration cycles. FIG. 4 shows a normal respiration flow and FIG. 5 shows a severely obstructed respiration cycle in which the inspiration period is characterized by two high positive lobes A and B and a relatively flat zone C between lobes A and B. In FIG. 4, the RMS deviation is indicated by the shaded area under the respiration flow curve and above the mean inspiration flow. In FIG. 5, the RMS deviation is indicated by the shaded area above the respiration flow curve and below the mean inspiration flow. As seen in FIG. 5, due to obstruction, the mean inspiration flow is greater than it would be without the second positive lobe B. Therefore, when analyzing the flow using shape factors of the '345 patent, the highly restricted and abnormal flow of FIG. 5 would not be detected as an obstruction.

Similarly, FIG. 6 shows another possible respiration curve for a patient with a partial airway obstruction. This curve includes an abnormally wide initial positive lobe D preceding a flat portion E. Once again, because of the large lobe D the mean inspiration flow is higher than for the more typical flow of FIG. 3. Using the prior art obstruction index, this condition may be detected as normal rather than being properly detected as an obstructed flow.

In order to detect these obstructions while continuing to properly respond to non-obstructed flows like the one of FIG. 4, the present invention assigns different weighting factors to the inspiration flow samples depending on:

(a) the magnitude of each sample with respect to the mean inspiration flow; and

(b) the time-wise position of each sample with respect to a time reference such as mid-inspiration.

By assigning a different weighting factor to a sample that is less than a particular value, for example, the mean flow, during the obstruction index or FFI calculation, there is an improved sensitivity to the respiration signal of FIG. 5 without affecting the FFI for normal breathing where most of the flow is greater than the mean.

Similarly, by assigning a different weighting factor to samples that occur after a time reference point, the subsequent samples become more significant. This improves sensitivity to the respiration signal of FIG. 6 without affecting the FFI for other breaths that are symmetrical in time about the center point of the inspiration.

An algorithm using one form of the invention for calculating the improved FFI is shown in FIG. 7. In step 100 of FIG. 2, a typical flow rate curve F (defined by a plurality of samples f_(i) where i is an index from 1 to the total number of samples n) is obtained. In step 200 of FIG. 7, the curve F is checked to insure that it is a valid inspiration curve. Next, in step 201 the curve F is trimmed to eliminate all samples f_(i) outside of the inspiration period. Methods of implementing steps 200 and 201 are discussed in more detail below. In step 202, a mean M is calculated for all the inspiration samples 1 through n using conventional techniques.

In step 204 two weighting factors which may be designated as value dependent factors w_(i) and time dependent factors v_(i) are assigned to each of the samples f_(i) based respectively on the amplitude of each sample and its time position in relation to the inspiration mean M and its center point respectively. For example, the factors w_(i) and v_(i) may be assigned for each flow measurement f_(i) using the following rules:

A1. If f_(i)>M then w_(i)=1

A2. If f_(i)<M then w_(i)=0.5

B1. If f_(i) is taken prior to the inspiration center point, then v_(i)=0.75.

B2. If f_(i) is taken after the inspiration center, then v_(i)=1.25.

Next, in step 206 two alternative FFI or obstruction indices are calculated using the formulas: ${{value\_ weighted}{\_ index}} = \frac{\sum\limits_{i = j}^{k}{W_{i} \cdot {{f_{i} - M}}}}{M \cdot d}$ ${{time\_ weighted}{\_ index}} = \frac{\sum\limits_{i = j}^{k}{V_{i} \cdot {{f_{i} - M}}}}{M \cdot d}$

Where j is the first and k is the last sample relative to a midportion or center half of the inspiration curve F and d is the number of samples of the midportion of inspiration or center half as shown in FIGS. 3-6, and M is the mean of the inspiration curve F. Alternatively, the algorithm may be described by the following steps:

Check the flow samples to confirm they represent a valid inspiration cycle with a shape within acceptable bounds.

Trim samples from any “pre-inspiratory period”;

Find the mean of the inspiration flow samples;

Sum the weighed absolute difference of the flow samples from mean for samples in the center half or mid portion of inspiration:

If flow sample is>mean, sum the difference (flow-mean);

If flow sample is<mean, sum ½ the difference;

If flow sample is before the center point of the inspiration, use 75% of the difference from above;

If flow sample is after the center point of the inspiration, use 125% of the difference from above;

Scale the sum by the mean and inspiration time to produce the flattening index: FFI=weighed absolute sum/(Center half time*mean inspiration flow)

As discussed above, in step 200 of FIG. 7, the curve F is checked to insure that it corresponds to a valid inspiration curve. The flow curve F is checked against an upper and lower bound to prevent processing of an inspiratory curve corrupted by a cough, sigh, etc. For example, as shown in FIG. 12, the curve F may be rejected if it exceeds at any time an upper limit curve UL or falls below a lower limit curve LL. UL may be selected at about 150% of the mean inspiratory flow and LL may be selected at about 50% of the mean inspiratory flow.

In step 201 the respiration curve is trimmed to eliminate samples f_(i) occurring before the actual inspiration period. One method of trimming includes the steps:

(1) determine the point where the flow reaches 75% of the peak inspiratory flow;

(2) determine the point where the flow reaches 25% of the peak inspiratory flow;

(3) extrapolate a line through these two points to the zero flow line to determine the point at the beginning of inspiration but use the first sample if the point is to the left of the first sample.

This trimming method is illustrated in FIG. 13. With reference to the figure, the respiration curve F crosses the zero flow level at T0. Once the maximum inspiratory flow is reached, two intermediate flow levels are determined: the ¼ inspiratory flow level (i.e. the flow equaling 25% of the maximum inspiratory flow) and the ¾ inspiratory flow level (i.e. the flow equaling 75% of the maximum inspiratory flow). In FIG. 13, curve F crosses these two levels at points F1 and F2, respectively. Using the times T1 and T2, corresponding to the points F1 and F2, the curve F is approximated by a line L. This line is then extended to the zero flow level to determine an extrapolated time TS as the starting time for inspiration period for curve F. Samples f_(i) obtained prior to TS are ignored.

The improvement resulting from the use of the above described value and time weighted obstruction indices can be seen with an examination of simulated tests. To this end, FIGS. 8, 9,10 and 11 show breathing patterns of patients with both normal and obstructed respiration. These patterns were analyzed using the weighted indices of the present invention, as well as the shape factor 2 that uses equal weight samples f_(i) as described in the '345 patent. The results of the tests are shown in the table below.

TABLE I Equal weight Value weighted Time weighted Index index index FIG. 8 0.26 0.25 0.25 FIG. 9 0.24 0.139 0.133 FIG. 10 0.31 0.18 0.13 FIG. 11 0.37 0.27 0.23

The weighted indices range from 0.3, which indicates no flattening or obstruction, to 0, which indicates gross obstruction. The separation point between these two classifications is 0.15, which may be used as a threshold value for comparison as described below.

FIG. 8 shows a normal breathing pattern. As can be seen from the table, all three indices have approximately the same value, thereby indicating that no increase in CPAP is needed.

FIG. 9 is similar in form to FIG. 5 in that it shows a pattern with two lobes separated by a relatively flat region. As seen in the table, if the equal weight index is used, no obstruction is found, while both improved indices are below the threshold and, therefore, both indicate an obstructed breathing pattern.

FIG. 10 shows a pattern similar to the one in FIG. 6 that starts off with a high initial lobe and then decays relatively slowly. For this pattern, the equal weight index and the value weighted index are both above the threshold. However, the time weighted index is below the threshold indicating an obstructed breathing pattern.

Finally, FIG. 11 shows another normal breathing pattern which has a shape somewhat different from the shape shown in FIG. 8. The three indices in the Table are all above the threshold level thereby indicating a normal pattern as well.

Although the invention has been described with reference to a particular embodiment, it is to be understood that this embodiment is merely illustrative of the application the principles of the invention. Thus, it is to be understood that numerous modifications may be made in the illustrative embodiment of the invention and other arrangements may be devised without departing from the spirit and scope of the invention. For example, while the preferred embodiment of the invention applies weighted samples to formulae which are used to identify a flattening of airflow, a similar method might be used with other formulae that detect roundness of flow or its deviation there from using a sinusoidal or other similar function. 

I claim:
 1. An apparatus for treating sleep apnea in a patient comprising: a gas source adapted to selectively provide breathable gas to the patient under pressure; a flow sensor adapted to sense the flow of air breathed by the patient and to generate a flow signal indicative of said gas flow; an obstruction detector coupled to said flow sensor, said obstruction detector including a weight assigning member arranged to assign several weighting factors to portions of said flow signal and to generate an obstruction signal; and a controller arranged to control the operation of said gas source and coupled to said flow sensor, said controller receiving said obstruction signal and altering the operation of said gas source in response to said obstruction signal.
 2. The apparatus of claim 1 wherein said flow signal includes a section corresponding to a single breathing cycle and wherein said portions are selected from said section.
 3. The apparatus of claim 1 wherein said flow sensor includes a sampler that generates flow samples and wherein said weight assigning member is adapted to assign a weighting factor for each sample.
 4. The apparatus of claim 3 wherein said samples have amplitudes and said weight assigning member assigns said weighting factors to said samples in accordance with said amplitudes.
 5. The apparatus of claim 4 wherein said samples have time positions and said weight assigning member assigns said weighting factors based on said time positions.
 6. An apparatus for monitoring or treating a patient having sleep disorder, said apparatus comprising: a flow sensor to generate a flow signal indicative of the patient's respiration; and an obstruction detector coupled to said flow sensor and adapted to determine a weighted average signal, said weighted average signal being dependent on a weighted average of said flow signal in accordance with one of an amplitude and a time position of portions of said flow signal, said obstruction detector including a signal generator that generates a signal indicative of an airway obstruction based on said weighted average signal.
 7. An apparatus for treating a patient having sleep disorder, said apparatus comprising: a mask; a gas source selectively supplying breathable air to said mask under pressure for the patient; a flow sensor to generate a flow signal indicative of the patient's respiration; an obstruction detector coupled to said flow sensor and adapted to determine a weighted average signal, said weighted average signal being dependent on a weighted average of said flow signal in accordance with one of an amplitude and a time position of portions of said flow signal; and a controller receiving said obstruction signal and generating in response a command for activating said gas source.
 8. The apparatus of claim 7 wherein said obstruction detector includes a comparator adapted to compare said weighted average signal to a threshold, said comparator generating said obstruction signal.
 9. The apparatus of claim 7 wherein said flow sensor includes a sampler that senses samples of a single breathing cycle and wherein said obstruction detector includes a weight assigning member that assigns a weighting factor to each sample.
 10. The apparatus of claim 9 wherein each sample has an amplitude and wherein said weight assigning member assigns said weighting factor based on said amplitude.
 11. The apparatus of claim 10 wherein said weight assigning member assigns said weighting factor based on whether said amplitude is above or below a predetermined value.
 12. The apparatus of claim 11 wherein said weight assigning member assigns a first weighting factor to samples having amplitudes lower than said predetermined value and second weighting factors to samples having amplitudes higher than said predetermined level.
 13. The apparatus of claim 12 wherein said first weighting factor is smaller than said second weighting factor.
 14. The apparatus of claim 9 wherein each sample has a time position and wherein said weight assigning member assigns said weighting factor based on said time position.
 15. The apparatus of claim 14 wherein said weight assigning member assigns said weighting factor based on whether said time position is before or after a predetermined position.
 16. The apparatus of claim 15 wherein said weight assigning member assigns a first weight to samples having time positions before said predetermined positions and second weighting factors to samples having time positions after said predetermined position.
 17. The apparatus of claim 16 wherein said first weighting factor is smaller than said second weighting factor.
 18. The apparatus of claim 9 wherein said flow signal includes a section corresponding to a single breathing cycle and wherein said sampler samples a portion of said section.
 19. The apparatus of claim 18 wherein said section corresponds to an inspiration period.
 20. The apparatus of claim 19 wherein said sampler samples a midportion of said inspiration period.
 21. A method of detecting an obstruction in the airway of a patient, said method comprising: measuring an air flow of the patient; detecting a predetermined section of said air flow; assigning weighting factors to portions of said predetermined section; determining an index value from said predetermined section based on said weighting factors as a measure of the obstruction.
 22. The method of claim 21 wherein said portions represent a midportion of inspiration.
 23. The method of claim 21 further comprising assigning weighting factors to said portions based on their amplitudes.
 24. The method of claim 21 further comprising assigning said weighting factors based on their time positions.
 25. The method of claim 21 further comprising assigning a first weighting factor to portions having amplitudes below a predetermined value and assigning a second weighting factor to portions having amplitudes above said predetermined value.
 26. The method of claim 25 further comprising setting said first weighting factor to be lower than said second weighting factor.
 27. The method of claim 21 further comprising assigning a first weighting factor to said portions having time positions before a predetermined position and second weighting factors other said portions having time positions after said predetermined position.
 28. The method of claim 27 wherein said first weighting factor is smaller than said second weighting factor.
 29. The method of claim 21 further comprising generating said index value from a weighted mean of said predetermined section.
 30. The method of claim 29 wherein said weighted mean is the sum of the weighted absolute difference of the said portions divided by the product of a mean of the predetermined section and the duration of said portions.
 31. A method of treating a person with sleep apnea comprising the steps of: determining an air flow signal indicative of the air flow of the patient; sampling a section of said air flow during successive breathing cycles to obtain a set of samples for a breathing cycle; assigning a weight to each sample; generating an obstruction signal based on said weights and said samples from said set of samples; and applying a CPAP therapy to the patient when an obstruction is indicated by said obstruction signal.
 32. The method of claim 31 wherein said set of samples comprises samples from a midportion of inspiration.
 33. The method of claim 32 further comprising the step of generating an average of said midportion samples.
 34. The method of claim 33, wherein each sample has an amplitude, further comprising the step of selecting a first weighting factor for samples having an amplitude below a predetermined threshold value and a second weighting factor for samples having an amplitude above said predetermined threshold value.
 35. The method of claim 34 wherein said first weighting factor is smaller than said second weighting factor.
 36. The method of claim 34 wherein said predetermined threshold value is a mean of said flow signal.
 37. The method of claim 33, wherein each sample has a time position, further comprising the step of selecting a first weighting factor for samples having time positions prior to a predetermined time position and selecting a second weighting factor for samples having time positions after said predetermined time position.
 38. The method of claim 37 wherein said first weighting factor is smaller than said second weighting factor.
 39. The method of claim 37 wherein said predetermined time position is a central point of said midportion.
 40. The method of claim 32 wherein said obstruction signal represents the sum of the weighted absolute difference of the said samples from a midportion of inspiration divided by the product of a mean of the set of samples and the duration of said midportion. 